package com.ruoyi.system.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.Blog;
import com.ruoyi.system.service.IBlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * blogController
 * 
 * @author mz
 * @date 2024-07-23
 */
@RestController
@RequestMapping("/admin")
public class MyBlogController extends BaseController
{

    @Autowired
    IBlogService blogService;

    @GetMapping("/blog")
    @PreAuthorize("@ss.hasPermi('admin:blog:query')")
    public TableDataInfo list(@RequestParam("blogStatus") String blogStatus) {
        // 激活分页插件
        startPage();

        List<Blog> blogList = blogService.selectBlogByStatus(blogStatus);
        return getDataTable(blogList);
    }

    /**
     * 审核功能
     * @param param0
     * @return
     */
    @PostMapping("/blog")
    @PreAuthorize("@ss.hasPermi('admin:blog:apply')")
    public AjaxResult modify(@RequestBody Blog param0) {

        blogService.xxxx(param0);
        return success("审核通过");
    }
    /**
     * 审核功能
     * @param param0
     * @return
     */
    @PostMapping("/blogIds")
    @PreAuthorize("@ss.hasPermi('admin:blog:apply')")
    public AjaxResult modify(@RequestBody List<Blog> param0) {

        blogService.modifyAllIds(param0);
        return success("审核通过");
    }

}
